using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblBoPhanUI
{ 
	private int idBoPhan;
	public int IdBoPhan
	{
		get { return idBoPhan;}
		set { idBoPhan = value;}
	}

	private String tenBoPhan;
	public String TenBoPhan
	{
		get { return tenBoPhan;}
		set { tenBoPhan = value;}
	}

	private String moTa;
	public String MoTa
	{
		get { return moTa;}
		set { moTa = value;}
	}

	private bool hoatDong;
	public bool HoatDong
	{
		get { return hoatDong;}
		set { hoatDong = value;}
	}

	public tblBoPhanUI() {}

	public tblBoPhanUI(int idBoPhan, String tenBoPhan, String moTa, bool hoatDong)
	 {
		this.idBoPhan = idBoPhan;
 		this.tenBoPhan = tenBoPhan;
 		this.moTa = moTa;
 		this.hoatDong = hoatDong;
 	}

	public int Add(String tenBoPhan, String moTa, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblBoPhan_Add",tenBoPhan,moTa,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idBoPhan, String tenBoPhan, String moTa, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblBoPhan_Update",idBoPhan,tenBoPhan,moTa,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idBoPhan)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblBoPhan_Delete",idBoPhan);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblBoPhan_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idBoPhan)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblBoPhan_Get",idBoPhan);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblBoPhan_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
